export default class AI extends Laya.Script {
    // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    rig=null;
    speed=-20;
    constructor() { super(); }
    
    onAwake(){
        this.rig=this.owner.getComponent(Laya.RigidBody);
        this.rig.linearVelocity={x:this.speed,y:0}
    }
    onTriggerEnter(){
        this.speed=-this.speed
        this.rig.linearVelocity={x:this.speed,y:0}
    }
}